package com.glela.packet.service.impl;

import com.glela.packet.mapper.RedPacketRecordBizMapper;
import com.glela.packet.mapper.RedPacketRecordMapper;
import com.glela.packet.model.RedPacketRecord;
import com.glela.packet.service.RedPacketRecordService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("redPacketRecordService")
public class RedPacketRecordServiceImpl implements RedPacketRecordService {

  @Autowired
  private RedPacketRecordMapper redPacketRecordMapper;
  @Autowired
  private RedPacketRecordBizMapper redPacketRecordBizMapper;

  @Override
  public RedPacketRecord getRedPacketRecordById(int id) {
    return redPacketRecordMapper.selectByPrimaryKey(id);
  }

  @Override
  public RedPacketRecord getRedPacketRecordByEventType(String eventType) {
    if (StringUtils.isBlank(eventType)) {
      return null;
    }
    return redPacketRecordBizMapper.findByEventType(eventType);
  }
}
